package com.company.myfirstjmixproject.entity.bom;

import io.jmix.core.entity.annotation.JmixGeneratedValue;
import io.jmix.core.metamodel.annotation.JmixEntity;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.UUID;


/**
 * 唯一约束在@Table注解中体现
 */
@JmixEntity
@Table(name = "SITE", uniqueConstraints = {
        @UniqueConstraint(name = "IDX_SITE_UNQ", columnNames = {"SITE_CODE"})
})
@Entity
public class Site {
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    @Id
    private UUID id;

    @Column(name = "VERSION", nullable = false)
    @Version
    private Integer version;

    @Column(name = "SITE_CODE", nullable = false)
    @NotNull
    private String siteCode;

    @Column(name = "SITE_NAME", nullable = false)
    @NotNull
    private String siteName;

    public String getSiteName() {
        return siteName;
    }

    public void setSiteName(String siteName) {
        this.siteName = siteName;
    }

    public String getSiteCode() {
        return siteCode;
    }

    public void setSiteCode(String siteCode) {
        this.siteCode = siteCode;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }
}